package bb.lanxing.lib.devices.bici.model;

import com.garmin.fit.MessageIndex;
import java.io.Serializable;
import java.nio.ByteBuffer;

public class BiciDeviceInfo implements Serializable {
    private byte autoPower;
    private int available;
    private byte biciColor;
    private byte biciMode;
    private int biciNumber;
    private byte[] biciUUID;
    private int capacity;
    private String displayVersion;
    private byte[] initialPasscode;
    private int miniVersion;
    private short reserve;
    private byte[] simNumber;
    private int totalCranks;
    private int totalWheels;
    private short version;
    private byte widthLight;

    public BiciDeviceInfo() {
        this.biciUUID = new byte[0];
        this.simNumber = new byte[0];
        this.initialPasscode = new byte[0];
        this.capacity = 1;
        this.available = 0;
        this.biciNumber = 0;
        this.version = (short) 0;
        this.biciColor = (byte) -1;
        this.biciMode = (byte) -1;
        this.miniVersion = 0;
        this.autoPower = (byte) 0;
        this.widthLight = (byte) 0;
        this.totalWheels = 0;
        this.totalCranks = 0;
        this.displayVersion = "0";
    }

    public BiciDeviceInfo(byte[] bArr) {
        ByteBuffer wrap = ByteBuffer.wrap(bArr);
        byte[] bArr2 = new byte[16];
        this.biciUUID = bArr2;
        wrap.get(bArr2);
        byte[] bArr3 = new byte[16];
        this.simNumber = bArr3;
        wrap.get(bArr3);
        byte[] bArr4 = new byte[8];
        this.initialPasscode = bArr4;
        wrap.get(bArr4);
        this.capacity = wrap.getInt();
        this.available = wrap.getInt();
        this.biciNumber = wrap.getInt();
        this.version = wrap.getShort();
        this.biciColor = wrap.get();
        this.biciMode = wrap.get();
        this.miniVersion = wrap.getInt();
        this.autoPower = wrap.get();
        this.widthLight = wrap.get();
        wrap.getShort();
        this.totalWheels = wrap.getInt();
        this.totalCranks = wrap.getInt();
        this.biciColor = (byte) (this.biciColor - 1);
        this.biciMode = (byte) (this.biciMode - 1);
        if (this.capacity == 0) {
            this.capacity = 1;
        }
        this.displayVersion = parseVersion(this.miniVersion);
    }

    private String parseVersion(int i) {
        return String.format("%d.%d.%d", i >>> 28, (i >>> 12) & 65535, i & MessageIndex.MASK);
    }

    public String toString() {
        return "\n biciUUID = " + getBiciUUID() + "\n simNumber = " + getSimNumber() + "\n initialPasscode = " + getInitialPasscode() + "\n capacity = " + this.capacity + "\n available = " + this.available + "\n biciNumber = " + this.biciNumber + "\n version = " + ((int) this.version) + "\n biciColor = " + ((int) this.biciColor) + "\n biciMode = " + ((int) this.biciMode) + "\n miniVersion = " + this.miniVersion + "\n displayVersion = " + this.displayVersion + "\n autoPower = " + ((int) this.autoPower) + "\n widthLight = " + ((int) this.widthLight) + "\n totalWheels = " + this.totalWheels + "\n totalCranks = " + this.totalCranks;
    }

    public String getBiciUUID() {
        return new String(this.biciUUID);
    }

    public void setBiciUUID(byte[] bArr) {
        this.biciUUID = bArr;
    }

    public String getSimNumber() {
        return new String(this.simNumber);
    }

    public void setSimNumber(byte[] bArr) {
        this.simNumber = bArr;
    }

    public String getInitialPasscode() {
        return new String(this.initialPasscode);
    }

    public void setInitialPasscode(byte[] bArr) {
        this.initialPasscode = bArr;
    }

    public int getCapacity() {
        return this.capacity;
    }

    public void setCapacity(int i) {
        this.capacity = i;
    }

    public int getAvailable() {
        return this.available;
    }

    public void setAvailable(int i) {
        this.available = i;
    }

    public int getBiciNumber() {
        return this.biciNumber;
    }

    public void setBiciNumber(int i) {
        this.biciNumber = i;
    }

    public short getVersion() {
        return this.version;
    }

    public void setVersion(short s) {
        this.version = s;
    }

    public byte getBiciColor() {
        return this.biciColor;
    }

    public void setBiciColor(byte b) {
        this.biciColor = b;
    }

    public byte getBiciMode() {
        return this.biciMode;
    }

    public void setBiciMode(byte b) {
        this.biciMode = b;
    }

    public int getMiniVersion() {
        return this.miniVersion;
    }

    public void setMiniVersion(int i) {
        this.miniVersion = i;
    }

    public String getDisplayVersion() {
        return this.displayVersion;
    }

    public void setDisplayVersion(String str) {
        this.displayVersion = str;
    }

    public byte getAutoPower() {
        return this.autoPower;
    }

    public void setAutoPower(byte b) {
        this.autoPower = b;
    }

    public byte getWidthLight() {
        return this.widthLight;
    }

    public void setWidthLight(byte b) {
        this.widthLight = b;
    }

    public int getTotalWheels() {
        return this.totalWheels;
    }

    public void setTotalWheels(int i) {
        this.totalWheels = i;
    }

    public int getTotalCranks() {
        return this.totalCranks;
    }

    public void setTotalCranks(int i) {
        this.totalCranks = i;
    }
}
